//============================================================================
//
//  Shader.h
//  
//  Created By Jeromy Stroh 2009
//
//============================================================================
#pragma once

struct ID3D11PixelShader;
struct ID3D11VertexShader;
typedef struct ID3D10Blob ID3DBlob;

namespace d3d11
{
	class Shader
	{
	public:
		Shader();
		~Shader();

		enum Type
		{
			UNKNOWN,
			VERTEX11,
			PIXEL11,
			VERTEX9,
			PIXEL9,
		}m_Type;

		void ConstructShader(Type type, LPCWSTR filepath, LPCSTR entryFunction);
		void ConstructPixelShader9(LPCWSTR filepath);

		ID3D11PixelShader		*getPixelShader11() const;
		ID3D11VertexShader		*getVertexShader11()  const;
		IDirect3DPixelShader9	*getPixelShader9() const;
		IDirect3DVertexShader9	*getVertexShader9() const;
		ID3DBlob				*getBlob() const { return m_pBlob; }

	private:
		IDirect3DDevice9		*m_pD3DDevice9;
		ID3D11Device			*m_pD3DDevice11;
		ID3DBlob *m_pBlob;

		union ShaderComPtr
		{
			ID3D11VertexShader		*m_pVertexShader11;
			ID3D11PixelShader		*m_pPixelShader11;
			IDirect3DVertexShader9	*m_pVertexShader9;
			IDirect3DPixelShader9	*m_pPixelShader9;
		}m_Shader;
	};
}